package com.itedge.solutionmanager.web.taskhandler.impl.solution;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;

import com.itedge.solutionmanager.domain.impl.Solution;
import com.itedge.solutionmanager.enumeration.MeetingResult;
import com.itedge.infrastructure.service.process.IProcessService;
import com.itedge.infrastructure.service.task.ITaskService;
import com.itedge.infrastructure.service.taskdata.ITaskDataEntityService;
import com.itedge.infrastructure.stereotype.WebHandler;
import com.itedge.solutionmanager.taskdata.impl.solution.ArchiveMeetingOutputTaskData;
import com.itedge.solutionmanager.web.convert.ISOFormattingConversionServiceBean;
import com.itedge.infrastructure.web.taskhandler.TaskHandlerException;
import com.itedge.infrastructure.web.taskhandler.TaskHandlerUtil;
import com.itedge.infrastructure.web.taskhandler.impl.AbstractTaskDataHandler;

@WebHandler
public class ArchiveMeetingOutputTaskDataHandler extends AbstractTaskDataHandler<ArchiveMeetingOutputTaskData, Solution> {
	
	@Autowired
    protected ArchiveMeetingOutputTaskDataHandler(ISOFormattingConversionServiceBean conversionService,
    		IProcessService<Solution> solutionProcessService,
    		ITaskDataEntityService<ArchiveMeetingOutputTaskData> archiveMeetingOutputTaskDataService,
			ITaskService<ArchiveMeetingOutputTaskData, Solution> archiveMeetingOutputTaskService,
			MessageSource messageSource) {
		super(conversionService, solutionProcessService, archiveMeetingOutputTaskDataService, 
				archiveMeetingOutputTaskService, messageSource);
	}
    
	@Override
	protected Class<ArchiveMeetingOutputTaskData> getTaskDataClass() {
		return ArchiveMeetingOutputTaskData.class;
	}
    
	@Override
	public Map<String,Object> loadTaskData(String taskId, Solution linkedSolution, Boolean forHistory) 
			throws TaskHandlerException {
		Map<String,Object> data = super.loadTaskData(taskId, linkedSolution, forHistory);
    	TaskHandlerUtil.applyDateTimePattern(data);
    	data.put("meetingresults", Arrays.asList(MeetingResult.class.getEnumConstants()));
    	return data;
	}

}
